/*
 *  MeshInstance.h
 *  SypXIPhone
 *
 *  Created by Luv Khemani on 5/14/10.
 *  Copyright 2010 Luv Khemani. All rights reserved.
 *
 */

#pragma once
#ifndef SYPX_MESHINSTANCE
#define SYPX_MESHINSTANCE

#include "Node.h"

namespace SypX 
{
	///A MeshInstance represents an instance of a mesh in the world/scene. It contains transformation/material 
	///information which is to be applied on to a mesh.
	class SYPXAPI MeshInstance : public Node 
	{
	public:
		///MeshInstance constructor
		MeshInstance();
		///MeshInstance deconstructor
		virtual ~MeshInstance();
		///Defines which mesh this instance will use when rendered
		void useMesh(Mesh* m);
		///Defines which texture this instance will use(optional)
		///Note : Mesh must have UV Coordinates defined internally unless generated on GPU
		///TODO: To be removed in favour of a material system in future
		void useTexture(Texture* t);		
		///Returns a pointer to the mesh which the instance is currently using
		Mesh* getMesh();
		///Returns a pointer to the Texture which the instance is currently using
		Texture* getTexture();
		///Do any pre-rendering updates (Changes to mesh/sprite state) before the draw call
		virtual void update();		
	private:
		Mesh* mesh;
		Texture* tex;
	};
	
}

#endif